package com.webapi.core.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webapi.core.dao.AgentDao;
import com.webapi.core.dao.OrderDao;
import com.webapi.core.dao.PayDao;
import com.webapi.core.dao.RequestLogDao;
import com.webapi.core.dao.TicketDao;
import com.webapi.core.model.persist.Agent;
import com.webapi.core.model.persist.Order;
import com.webapi.core.model.persist.Pay;
import com.webapi.core.model.persist.RequestLog;
import com.webapi.core.model.persist.Ticket;
import com.webapi.core.service.FacadeService;

@Service
public class FacadeServiceImpl implements FacadeService {

	@Autowired
	private RequestLogDao requestDao;
    @Autowired
    private OrderDao orderDao;
    @Autowired
    private PayDao payDao;
    @Autowired
    private TicketDao ticketDao;
    @Autowired
    private AgentDao agentDao;
    
    @Override
	public void saveRequest(RequestLog request) {
    	requestDao.save(request);
	}

	@Override
    public Order findOrder(Integer id) {
        return orderDao.get(id);
    }

	@Override
	public List<Order> findOrders(List<String> cds) {
		return orderDao.get(cds);
	}


	@Override
    public void saveOrder(Order order) {
        orderDao.save(order);
    }

    @Override
    public void updateOrder(Order order) {
        orderDao.update(order);
    }

    @Override
    public Pay findPay(Integer id) {
        return payDao.get(id);
    }

    @Override
    public List<Pay> findPay(String cd) {
        return payDao.get(cd);
    }

    @Override
    public void updatePay(Pay pay) {
        payDao.update(pay);
    }

    @Override
    public Ticket findTicket(Integer id) {
        return ticketDao.get(id);
    }

    @Override
    public List<Ticket> findTicket(String cd) {
        return ticketDao.get(cd);
    }

    @Override
    public void updateTicket(Ticket ticket) {
        ticketDao.update(ticket);
    }

    @Override
    public List<Agent> findAgents() {
        return agentDao.all();
    }

}
